/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jigdo.data.template.section.DESCEntries;

import jigdo.data.template.section.TemplateSection;
import jigdo.utils.ByteUtils;

/**
 *
 * @author John R Sohn
 */
public class TemplateDESCImageInfoEntry extends TemplateDESCEntry {
   
    public TemplateDESCImageInfoEntry(TemplateSection parent, int ordinalPos, long lastOffset)
    {
        super(parent,  ordinalPos,lastOffset);
        this.DataSize=0;
    }
    
     /**
      * 6      imgLen        "Length in bytes of the original image"
      */
    public long ImageLength;
    
    /**
     * 16      imgMD5        "MD5 checksum of the original image"
     */
    public String ImageMD5;
    
    /**
     * 4      blockLen      "Number of bytes used for calculating RsyncSums below"
     */
    public int BlockLength;
    
    @Override
     public int ReadEntry(byte[] data, int startindex)
    {
        ImageLength = ByteUtils.GetIntFromBytes(data, startindex, 6);
        startindex+=6;
        
        ImageMD5 = ByteUtils.GetString(data, startindex, 16);
        startindex+=16;
        
        BlockLength = (int)ByteUtils.GetIntFromBytes(data, startindex, 4);
        startindex+=4;
        
        return startindex;
        
    }
    
}
